<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>网络货运平台省运管数据控制台</title>
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="小镖人、社区、网络货运">
    <meta name="description" content="小镖人、社区、网络货运">
    <link rel="stylesheet" href="../../../xbr_layui_extend/layui-v2.6.8/css/layui.css">
</head>
<body>
<div class="layui-fluid" style="padding: 15px;">
    <form class="layui-form" action="" lay-filter="form-post" id="userForm" method="post" >
        <div class="layui-row">
            <div class="layui-col-xs10">
                <div class="layui-form-item">
                    <label class="layui-form-label">转账凭证号</label>
                    <div class="layui-input-block">
                        <input id="tradeNo" name="tradeNo" lay-verify="required" placeholder="请输入凭证号" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-xs2" style="text-align: center">
                <div class="layui-form-item">
                   <a class="layui-btn" lay-submit="" lay-filter="post-btn">查询</a>
                </div>
            </div>
        </div>
    </form>
    <!--  结果  -->
    <table class="layui-table" lay-even="" lay-skin="nob">
        <thead><tr><th colspan="4">查询结果如下:</th></tr></thead>
        <tbody id="result" style="display: none">
        <tr>
            <td>转账凭证号：</td><td><span class="bind" id="origThirdVoucher">--</span></td>
            <td>银行流水号：</td><td><span class="bind" id="frontLogNo">--</span></td>
        </tr>
        <tr>
            <td>转出账户：</td><td><span class="bind" id="outAcctNo">--</span></td>
            <td>转出网点：</td><td><span class="bind" id="outAcctBankName">--</span></td>
        </tr>
        <tr>
            <td>转入账户：</td><td><span class="bind" id="inAcctNo">--</span></td>
            <td>转入账户名：</td><td><span class="bind" id="inAcctName">--</span></td>
        </tr>
        <tr>
            <td>转入开户行：</td><td><span class="bind" id="inAcctBankName">--</span></td>
            <td>交易状态：</td><td><span class="bind" id="stt">--</span></td>
        </tr>
        <tr>
            <td>交易金额：</td><td><span class="bind" id="tranAmount">--</span>元</td>
            <td>手续费：</td><td><span class="bind" id="fee">--</span>元</td>
        </tr>
        <tr>
            <td>退账标识：</td><td><span class="bind" id="isBack">--</span></td>
            <td>银行处理结果：</td><td><span class="bind" id="yhcljg">--</span></td>
        </tr>
        <tr>
            <td>原因描述：</td><td><span class="bind" id="backRem">--</span></td>
        </tr>

        </tbody>
    </table>
</div>

<script src="../../../xbr_layui_extend/layui-v2.6.8/layui.js"></script>
<script>
    function child(tradeNo){
        layui.extend({
            admin: '/platform/xbr_layui_extend/admin' //集成路径
        }).use(["admin",'form'], function () {
            const $ = layui.$, form = layui.form,admin = layui.admin;
            if (tradeNo != null) {
                $("#tradeNo").val(tradeNo);
                queryTradeByNo(tradeNo)
            }
            //上传完毕 提交表单
            form.render(null, 'form-post');
            form.on('submit(post-btn)', function (data) {
                queryTradeByNo(data.field.tradeNo);
                return false;
            });
            //开始查询
            function queryTradeByNo(tradeNo) {
                admin.req({
                    url: "/platform/pab/singleQueryTrade",
                    data: {tradeNo: tradeNo},
                    done: function (res) {
                        if (res.data == null) return;
                        $("#result").show();
                        bindResData(res.data)
                    }
                });
            }

            //绑定数据
            function bindResData(data) {
                $(".bind").each(function (index,item) {
                    if (item.id==="stt") $(item).text(sttNames(data[item.id]));
                    else if (item.id==="isBack") $(item).text(data[item.id]==='0'?"正常":"已退账");
                    else $(item).text(data[item.id]);
                })
            }

            //交易状态
            function sttNames(state) {
                switch (state) {
                    case "20": return "20-交易成功";
                    case "30": return "30-交易失败";
                    case "40": return "40-处理中";
                    default: return state+"-银行受理中";
                }
            }

        });
    }

</script>
</body>
</html>